# 导包
import requests
import config


# 创建接口类
class DeptAPI:
    # 获取组织架构列表
    def get_dept_list(self, token):
        return requests.get(url=f"{config.BASE_URL}/api/company/department", headers={"Authorization": token})

    # 创建部门
    def insert_dept(self, token, insert_data):
        return requests.post(url=f"{config.BASE_URL}/api/company/department", headers={"Authorization": token}, json=insert_data)

    # 查询部门
    def select_dept(self, token, dept_id):
        return requests.get(url=f"{config.BASE_URL}/api/company/department/{dept_id}", headers={"Authorization": token})

    # 修改部门
    def update_dept(self, token, dept_id, update_data):
        return requests.put(url=f"{config.BASE_URL}/api/company/department/{dept_id}", headers={"Authorization": token}, json=update_data)

    # 删除部门
    def delete_dept(self, token, dept_id):
        return requests.delete(url=f"{config.BASE_URL}/api/company/department/{dept_id}", headers={"Authorization": token})


